package hoyo.zqy;

import com.sun.org.apache.xpath.internal.SourceTree;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

@SpringBootApplication
@MapperScan("hoyo.zqy.*.mapper")
@ServletComponentScan(value = {"hoyo.zqy.basic.listener"})
//@EnableAutoConfiguration//自动配置-静态资源放行
//@Component//扫描包-扫描当前包和其他子包
public class PetApp {
    public static void main(String[] args) {
        SpringApplication.run(PetApp.class);
        System.out.println("启动成功");
    }
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();
        //文件最大
        factory.setMaxFileSize(DataSize.parse("50MB"));
        //设置总上传数据总大小
        factory.setMaxRequestSize(DataSize.parse("50MB"));
        return factory.createMultipartConfig();
    }
}
